/**
 * @Filename: stopwatch.h
 * @Description:
 * @Author: chengxiaojun
 * @Email: csforgood@gmail.com
 * @Time: 2011/11/11
 */

#ifndef __STOPWATCH_H__

#define  __STOPWATCH_H__

#include <sys/types.h>
#include <stdio.h>
#include <boost/thread/xtime.hpp>


class Stopwatch {
	public:

		Stopwatch(bool start_running=true) ;

		void start();
		void stop();
		void reset();

		double elapsed();
		int64_t interval();
                int64_t get_start_time();
                int64_t get_stop_time();
	private:
		bool m_running;
		boost::xtime start_time;
		boost::xtime stop_time;
		boost::xtime elapsed_time;
};
#endif
